package cn.winwintech.Incense.model;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.base.webapp.model.BaseModel;

@Entity
@Table(name = "operation")
public class Operation extends BaseModel {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4066326589091874346L;
	private Long id;
	private Tree tree;
	//  0: "结香",    1: "采香",    2: "管理",
	private int type;
	private String subtype;
	// 结香方法（预留） 采香方法（整株/截取）
	private String method;
	// 备注
	private String comment;

	private String photo1;
	private String photo2;
	private String photo3;
	private String photo4;
	// 操作人
	private User operaterBy;
	// 天气
	private String weather;
	// 温度
	private String temperature;
	// 湿度
	private String humidity;
	// 风向
	private String wind;

	// 基径
	private String trLowDiameter;
	// 胸径
	private String trHightDiameter;
	// 树高
	private String trHeight;
	// 冠幅
	private String trCoverarea;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@OneToOne(targetEntity = Tree.class)
	@JoinColumn(name = "tree_id")
	public Tree getTree() {
		return tree;
	}

	public void setTree(Tree tree) {
		this.tree = tree;
	}

	@OneToOne(targetEntity = User.class)
	public User getOperaterBy() {
		return operaterBy;
	}

	public void setOperaterBy(User operaterBy) {
		this.operaterBy = operaterBy;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public String getMethod() {
		return method;
	}

	public void setMethod(String method) {
		this.method = method;
	}

	public String getSubtype() {
		return subtype;
	}

	public void setSubtype(String subtype) {
		this.subtype = subtype;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public String getPhoto1() {
		return photo1;
	}

	public void setPhoto1(String photo1) {
		this.photo1 = photo1;
	}

	public String getPhoto2() {
		return photo2;
	}

	public void setPhoto2(String photo2) {
		this.photo2 = photo2;
	}

	public String getPhoto3() {
		return photo3;
	}

	public void setPhoto3(String photo3) {
		this.photo3 = photo3;
	}

	public String getPhoto4() {
		return photo4;
	}

	public void setPhoto4(String photo4) {
		this.photo4 = photo4;
	}

	public String getWeather() {
		return weather;
	}

	public void setWeather(String weather) {
		this.weather = weather;
	}

	public String getTemperature() {
		return temperature;
	}

	public void setTemperature(String temperature) {
		this.temperature = temperature;
	}

	public String getHumidity() {
		return humidity;
	}

	public void setHumidity(String humidity) {
		this.humidity = humidity;
	}

	public String getTrLowDiameter() {
		return trLowDiameter;
	}

	public void setTrLowDiameter(String trLowDiameter) {
		this.trLowDiameter = trLowDiameter;
	}

	public String getTrHightDiameter() {
		return trHightDiameter;
	}

	public void setTrHightDiameter(String trHightDiameter) {
		this.trHightDiameter = trHightDiameter;
	}

	public String getWind() {
		return wind;
	}

	public void setWind(String wind) {
		this.wind = wind;
	}

	public String getTrHeight() {
		return trHeight;
	}

	public void setTrHeight(String trHeight) {
		this.trHeight = trHeight;
	}

	public String getTrCoverarea() {
		return trCoverarea;
	}

	public void setTrCoverarea(String trCoverarea) {
		this.trCoverarea = trCoverarea;
	}

	public Operation() {
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((comment == null) ? 0 : comment.hashCode());
		result = prime * result + ((humidity == null) ? 0 : humidity.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((method == null) ? 0 : method.hashCode());
		result = prime * result + ((operaterBy == null) ? 0 : operaterBy.hashCode());
		result = prime * result + ((photo1 == null) ? 0 : photo1.hashCode());
		result = prime * result + ((photo2 == null) ? 0 : photo2.hashCode());
		result = prime * result + ((photo3 == null) ? 0 : photo3.hashCode());
		result = prime * result + ((photo4 == null) ? 0 : photo4.hashCode());
		result = prime * result + ((subtype == null) ? 0 : subtype.hashCode());
		result = prime * result + ((temperature == null) ? 0 : temperature.hashCode());
		result = prime * result + ((trHightDiameter == null) ? 0 : trHightDiameter.hashCode());
		result = prime * result + ((trLowDiameter == null) ? 0 : trLowDiameter.hashCode());
		result = prime * result + ((trCoverarea == null) ? 0 : trCoverarea.hashCode());
		result = prime * result + ((trHeight == null) ? 0 : trHeight.hashCode());
		result = prime * result + type;
		result = prime * result + ((weather == null) ? 0 : weather.hashCode());
		result = prime * result + ((wind == null) ? 0 : wind.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Operation other = (Operation) obj;
		if (comment == null) {
			if (other.comment != null)
				return false;
		} else if (!comment.equals(other.comment))
			return false;
		if (humidity == null) {
			if (other.humidity != null)
				return false;
		} else if (!humidity.equals(other.humidity))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (method == null) {
			if (other.method != null)
				return false;
		} else if (!method.equals(other.method))
			return false;
		if (operaterBy == null) {
			if (other.operaterBy != null)
				return false;
		} else if (!operaterBy.equals(other.operaterBy))
			return false;
		if (photo1 == null) {
			if (other.photo1 != null)
				return false;
		} else if (!photo1.equals(other.photo1))
			return false;
		if (photo2 == null) {
			if (other.photo2 != null)
				return false;
		} else if (!photo2.equals(other.photo2))
			return false;
		if (photo3 == null) {
			if (other.photo3 != null)
				return false;
		} else if (!photo3.equals(other.photo3))
			return false;
		if (photo4 == null) {
			if (other.photo4 != null)
				return false;
		} else if (!photo4.equals(other.photo4))
			return false;
		if (subtype == null) {
			if (other.subtype != null)
				return false;
		} else if (!subtype.equals(other.subtype))
			return false;
		if (temperature == null) {
			if (other.temperature != null)
				return false;
		} else if (!temperature.equals(other.temperature))
			return false;
		if (trHightDiameter == null) {
			if (other.trHightDiameter != null)
				return false;
		} else if (!trHightDiameter.equals(other.trHightDiameter))
			return false;
		if (trLowDiameter == null) {
			if (other.trLowDiameter != null)
				return false;
		} else if (!trLowDiameter.equals(other.trLowDiameter))
			return false;
		if (trCoverarea == null) {
			if (other.trCoverarea != null)
				return false;
		} else if (!trCoverarea.equals(other.trCoverarea))
			return false;
		if (trHeight == null) {
			if (other.trHeight != null)
				return false;
		} else if (!trHeight.equals(other.trHeight))
			return false;
		if (type != other.type)
			return false;
		if (weather == null) {
			if (other.weather != null)
				return false;
		} else if (!weather.equals(other.weather))
			return false;
		if (wind == null) {
			if (other.wind != null)
				return false;
		} else if (!wind.equals(other.wind))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "Operation [id=" + id + ", tree=" + tree + ", type=" + type + ", subtype=" + subtype + ", method="
				+ method + ", comment=" + comment + ", photo1=" + photo1 + ", photo2=" + photo2 + ", photo3=" + photo3
				+ ", photo4=" + photo4 + ", operaterBy=" + operaterBy + ", weather=" + weather + ", temperature="
				+ temperature + ", humidity=" + humidity + ", wind=" + wind + ", trLowDiameter=" + trLowDiameter
				+ ", trHightDiameter=" + trHightDiameter + ", trHeight=" + trHeight + ", trCoverarea=" + trCoverarea
				+ "]";
	}

}
